#include "Monkey.h"

Monkey::Monkey(): 
Animation(), 
speed(0),
isBlueMonkey(false),
ptsThisJump(false){
	speed = (float)M_SPEED;
}

Monkey::Monkey(int x, int y): 
Animation(M_PATH, x, y, M_WIDTH, M_HEIGHT, M_SRC_X, M_SRC_Y, M_SRC_W, M_SRC_H, M_SRC_OFFSET, M_FRAMES, M_ANIM_FPS, M_ANIM_LOOP, M_ANIM_HORZ), 
speed(0) {
	speed = (float)M_SPEED;

	// collider
	delete collider;
	collider = new CustomRectangle((float)x, (float)y, (float)(M_WIDTH - M_COLLIDER_OFFSET), (float)(M_HEIGHT - M_COLLIDER_OFFSET));
	isCircular = false;
}

void Monkey::Update(float dt) {
	// update the animation so the frames change, since this overwrites the update of the animation
	Animation::Update(dt);
	// move to the left
	Move(dt);
}

void Monkey::Move(float dt) {
	// move left
	SetPosition(dstRect.x - (int)(speed * dt), dstRect.y);
	// make invisible if past the left of the screen
	if (dstRect.x < 0 - dstRect.w) {
		isVisible = false;
	}
}

void Monkey::Reset(int x, int y) {
	isVisible = true;
	ptsThisJump = false;
	SetPosition(x, y);
}

Monkey::~Monkey() {
	
}